package solution._0010._0011;

/**
 * Created by chen_snow
 * Date: 2021/5/9 22:38
 * Description: 盛最多水的容器
 */
public class Solution {
    public int maxArea(int[] height) {
        int start = 0;
        int end = height.length - 1;
        int result = 0;

        while (end > start) {
            int area = Math.min(height[start], height[end]) * (end - start);
            result = Math.max(result, area);

            if (height[start] < height[end]) {
                start++;
            } else {
                end--;
            }
        }
        return result;
    }
}
